package com.pt25.base.web;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.UUID;

/**
 * web请求会话信息
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class WebSession {
    /**
     * 租户id
     */
    @Builder.Default
    private String tenantId = "0";
    /**
     * 全链路id
     */
    private String traceId;
    /**
     * rpc请求token
     */
    private String rpcToken;

    public String getTraceId() {
        return traceId == null ? UUID.randomUUID().toString() : traceId;
    }
}
